export function toTree(list, kId, pId) {
  const menuObj = {}
  list.forEach(item => {
    //
    item.children = []
    const key = item[kId]
    const value = item
    menuObj[key] = value
  })
  return list.filter(item => {
    if (item[pId] !== null && item[pId] !== '') {
      const key = item[pId]
      menuObj[key].children.push(item)
      return false
    }
    return true
  })
}
